using System;
using System.Collections.Generic;
using System.Linq;
using Seagull.DAL.Stat;
using Seagull.IDAL.Stat;
using Seagull.Model.Stat;

namespace Seagull.Controls.Tests
{
    class FakeStatisticSource: IStatisticSource
    {
        public ChannelStatistics GetChannelStatisticsAfter(DateTime startTime)
        {
            return new ChannelStatistics(startTime, GenerateStatistics().Take(365 * 24).ToArray());
        }

        public Statistic[] GetFrameStatisticsOfHour(DateTime dateTime)
        {
            return GenerateStatistics().Take(3600*50).ToArray();
        }

        private IEnumerable<Statistic> GenerateStatistics()
        {
            var rand = new Random();
            Func<int, int, byte> nextByte = (min, max) => (byte)rand.Next(min, max);
            while (true)
            {
                yield return new Statistic(nextByte(200, 256), nextByte(150, 200));
            }
        } 
    }
}